﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.ComponentModel;
using MockupDesigner.Editors.TextEditors;
using System.Windows.Forms;
using System.Windows.Controls;

namespace MockupDesigner.Items
{
    [ListBoxEditor]
    public class ListBoxItem : ContentControlContainerItem
    {
        public ListBoxItem()
        {
            List<ContentControl> list = new List<ContentControl>();
            System.Windows.Controls.ListBoxItem lbi = new System.Windows.Controls.ListBoxItem() { Content = "Item1" };
            list.Add(lbi);
            lbi.IsSelected = true;
            lbi = new System.Windows.Controls.ListBoxItem() { Content = "Item2" };
            list.Add(lbi);
            ItemsSource = list.ToArray();
        }

        protected override void SetNewSelectedIndex(int oldIndex)
        {
            (ItemsSource.ElementAt(oldIndex) as System.Windows.Controls.ListBoxItem).IsSelected = false;
            (ItemsSource.ElementAt(SelectedIndex) as System.Windows.Controls.ListBoxItem).IsSelected = true;
        }
    }
}
